package com.wilmer.childEveryday.service.impl;

import java.util.List;

import com.wilmer.common.utils.DateUtils;
import com.wilmer.common.utils.SecurityUtils;
import com.wilmer.schedule.domain.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wilmer.childEveryday.mapper.YwChildEverydayMapper;
import com.wilmer.childEveryday.domain.YwChildEveryday;
import com.wilmer.childEveryday.service.IYwChildEverydayService;

/**
 * 幼儿日常Service业务层处理
 *
 * @author zl
 * @date 2024-04-15
 */
@Service
public class YwChildEverydayServiceImpl implements IYwChildEverydayService {
    @Autowired
    private YwChildEverydayMapper ywChildEverydayMapper;

    /**
     * 查询幼儿日常
     *
     * @param childEverydayId 幼儿日常主键
     * @return 幼儿日常
     */
    @Override
    public YwChildEveryday selectYwChildEverydayByChildEverydayId(Long childEverydayId) {
        return ywChildEverydayMapper.selectYwChildEverydayByChildEverydayId(childEverydayId);
    }

    /**
     * 查询幼儿日常列表
     *
     * @param ywChildEveryday 幼儿日常
     * @return 幼儿日常
     */
    @Override
    public List<YwChildEveryday> selectYwChildEverydayList(YwChildEveryday ywChildEveryday) {
        return ywChildEverydayMapper.selectYwChildEverydayList(ywChildEveryday);
    }

    @Override
    public List<UserVO> childListByDeptId() {
        Long deptId = SecurityUtils.getDeptId();
        return ywChildEverydayMapper.childListByDeptId(deptId);
    }

    /**
     * 新增幼儿日常
     *
     * @param ywChildEveryday 幼儿日常
     * @return 结果
     */
    @Override
    public int insertYwChildEveryday(YwChildEveryday ywChildEveryday) {
        ywChildEveryday.setCreateTime(DateUtils.getNowDate());
        return ywChildEverydayMapper.insertYwChildEveryday(ywChildEveryday);
    }

    /**
     * 修改幼儿日常
     *
     * @param ywChildEveryday 幼儿日常
     * @return 结果
     */
    @Override
    public int updateYwChildEveryday(YwChildEveryday ywChildEveryday) {
        ywChildEveryday.setUpdateTime(DateUtils.getNowDate());
        return ywChildEverydayMapper.updateYwChildEveryday(ywChildEveryday);
    }

    /**
     * 批量删除幼儿日常
     *
     * @param childEverydayIds 需要删除的幼儿日常主键
     * @return 结果
     */
    @Override
    public int deleteYwChildEverydayByChildEverydayIds(Long[] childEverydayIds) {
        return ywChildEverydayMapper.deleteYwChildEverydayByChildEverydayIds(childEverydayIds);
    }

    /**
     * 删除幼儿日常信息
     *
     * @param childEverydayId 幼儿日常主键
     * @return 结果
     */
    @Override
    public int deleteYwChildEverydayByChildEverydayId(Long childEverydayId) {
        return ywChildEverydayMapper.deleteYwChildEverydayByChildEverydayId(childEverydayId);
    }
}
